package yannan.voiplock4ble.utils;

import android.app.Activity;

import java.util.ArrayList;
import java.util.List;

/**
 * 说明：
 * 作者：mainTel
 * 时间：2016/12/19 09:52
 * 备注：
 */
public class ActivityCollector {

    public static List<Activity> activities = new ArrayList<Activity>();

    public static void addActivity(Activity activity) {
        activities.add(activity);
    }

    public static void removeActivity(Activity activity) {
        activities.remove(activity);
    }

    public static void finishAll() {
        for (Activity activity : activities) {
            try {
                if (!activity.isFinishing()) {
                    activity.finish();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }


}
